////////////////////////////////////////////////////////////
// time.h
////////////////////////////////////////////////////////////
#pragma once

#if defined(WIN32) || defined(WIN64)
#define sleep(x) Sleep((x)*1000)
#else
#include <time.h>
#define Sleep(x) \
   do{\
      struct timespec interval, remainder;\
      interval.tv_sec = (unsigned int)((x)/1000);\
      interval.tv_nsec = (((x)-(interval.tv_sec*1000))*1000000);\
      nanosleep(&interval,&remainder);\
   }while(0);
#endif

void        log_message( char * aFmt, ... );
struct tm * time_by_str( char * aBuf, struct tm * aTout );
struct tm * current_time( struct tm * aTval );
int         current_time_to_str( char * aBuf, int aBufLen );
void        remove_newline( char * aBufPtr , int aBufLen );

////////////////////////////////////////////////////////////
